﻿@model SMECustomerWebsite.Models.ViewModels.AdminChecklist.QuetionChecklistViewModel
<ul id="menu_product_handbook_detail" class="nav nav-tabs bar_tabs sme-tabs" role="tablist">
    @*<li role="presentation" class="">
            @Html.ActionLink(@SMECustomerWebsite.Core.Resources.Resource.ProHandbookProDetailInfoTab, "ProductDetail", "ProductHandbook", new { productid = Request.QueryString["productid"] }, null)
        </li>*@
    <li role="presentation" class="active">
        @Html.ActionLink(@SMECustomerWebsite.Core.Resources.Resource.ProHandbookProDetailChecklistTab, "Checklist", "ProductHandbook", new { productid = Request.QueryString["productid"] }, null)
    </li>
</ul>

<!--Modal  question -->
<div class="modal fade cm-celebration-representative-info" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
                @using (Html.BeginForm("QuestionChecklist", "AdminChecklist", FormMethod.Post, new { @class = "form-horizontal form-label-left" }))
                {
                <div class="col-md-12 profile_details">
                    <div class="well profile_view">
                        <div class="x_content form-horizontal form-label-left">

                            @Html.HiddenFor(m => m.ProductID)
                            @Html.HiddenFor(m => m.questionEdit.QuestionId, new { id = "questionIdHidden" })
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12">
                                    @SMECustomerWebsite.Core.Resources.Resource.AdminChecklistQuestionTab
                                </label>
                                <div class="col-md-9 col-sm-9 col-xs-12">
                                    @Html.TextAreaFor(m => m.questionEdit.Title, new { enctype = "multipart/form-data", id = "questionInput", required = "required", @class = "form-control", rows = "3" })
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12">
                                    @SMECustomerWebsite.Core.Resources.Resource.AdminChecklistQuestionTab English
                                </label>
                                <div class="col-md-9 col-sm-9 col-xs-12">
                                    @Html.TextAreaFor(m => m.questionEdit.TitleEn, new { enctype = "multipart/form-data", id = "questionEnInput", required = "required", @class = "form-control", rows = "3" })
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-12 col-md-offset-3">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="submit" class="btn btn-primary" id="save_change_question">Save changes</button>
                </div>
                }
            </div>
        </div>
    </div>
</div>
<!-- /modals -->


<div class="row">
    <div class="col-md-12">
        <div class="x_panel">
            <div class="x_title">
                <h2>CHECKLIST CUSTOMER</h2>
                <ul class="nav navbar-right panel_toolbox">
                    <li>
                        <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                    </li>
                </ul>
                <div class="clearfix"></div>
            </div>
            <div class="x_content">
                @Html.Action("SubMenuAdminChecklistDetail", "System")

                <!--question checklist-->
                <div id="div_question_checklist" class="row">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>@SMECustomerWebsite.Core.Resources.Resource.ChecklistQuestionTitle</h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li>
                                    <a onclick="return addQuestion();"><i class="fa fa-plus-square"></i></a>
                                </li>
                                <li>
                                    <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <form id="cust_checklist_question" method="post" class="form-horizontal form-label-left">
                                @foreach (var item in Model.listQuestion)
                                {
                                    <div class="form-group">
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label" style="text-align:left" id="label_en_@item.QuestionId">@item.TitleEn </label><br />
                                        <label class="control-label" style="text-align:left" id="label_@item.QuestionId">@item.Title </label>
                                        <div style="float:right">
                                            @Html.ActionLink("Edit", null, null, null, new { @class = "btn btn-primary", onclick = "return editQuestion(" + item.QuestionId + ");" })
                                        </div>
                                    </div>
                                }
                            </form>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <!-- End to do list -->
</div>
@section scripts
{
    <script type="text/javascript">
        function editQuestion(question) {
            $('#questionIdHidden').val(question);
            $('#questionInput').val($('#label_' + question).text());
            $('#questionEnInput').val($('#label_en_' + question).text());
            $('.cm-celebration-representative-info').modal('show');
            return false;
            //e.preventDefault()
        }
        function addQuestion() {
            $('#questionIdHidden').val('0');
            $('.cm-celebration-representative-info').modal('show');
            return false;
            //e.preventDefault()
        }
    </script>
}
